<?php
###
#  Baing PHP 框架 1.0.0
#  http://baing.co/
#
#  Copyright: 白晓阳
#  License: CC BY-NC-SA 4.0
#  https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh
###

namespace bai\process;

use bai\Action;
use bai\resource\document\Download as DownloadDoc;


class Download extends \bai\Process
{
    public const PATH = '/download/:resource?';

    protected function get(): array
    {
        $resource = $this->resource ?: DownloadDoc::RESOURCE_DEFAULT;
        $runtime = [
            'fields' => [
                $resource => [
                    'type' => 'text',
                    'required' => true,
                ],
            ],
            'values' => self::$request->query,
        ];
        $actions = [
            [
                'action' => 'Validate',
                'runtime' => $runtime,
                'order' => Action::ORDER_PRE,
            ],
            ['action' => 'Download']
        ];
        return $actions;
    }
}
